﻿namespace FFF.Test.Util.Localization
{
    using Abp.Configuration.Startup;
    using Abp.Localization;
    using Abp.Localization.Dictionaries;
    using Abp.Localization.Dictionaries.Json;
    using Abp.Localization.Dictionaries.Xml;
    using Abp.Reflection.Extensions;
    using FFF.Test.Util.Consts;

    /// <summary>
    /// 多语言的设置
    /// </summary>
    public static class YdmAbpEntityLocalizationConfigurer
    {
        /// <summary>
        /// 初始化配置文件加载
        /// </summary>
        /// <param name="localizationConfiguration">返回配置信息</param>
        public static void Configure(ILocalizationConfiguration localizationConfiguration)
        {
            localizationConfiguration.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flags england"));
            localizationConfiguration.Languages.Add(new LanguageInfo("zh-CN", "中文", "famfamfam-flags tr", isDefault: true));

            localizationConfiguration.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    AppConfigConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        typeof(YdmAbpEntityLocalizationConfigurer).GetAssembly(),
                        "FFF.Test.Util.Localization.SourceFiles"
                    )
                )
            );
        }
    }
}